home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- //
- // Creation Date: May 15, 1997
- // Author: sw
- //
- // Procedure Name:
- // AEimageTemplate
- //
- // Description Name;
- // Creates the attribute editor controls for the image Node
- //
- // Input Value:
- // nodeName
- //
- // Output Value:
- // None
- //
-
-
- //
- // Procedure Name:
- // AEassignImageCB
- //
-
- global proc int AEassignImageCB( string $type,
- string $fileAttribute,
- string $filename,
- string $fileType )
- {
- setAttr $type 0;
- setAttr $fileAttribute -type "string" $filename;
-
- string $currentDir = `workspace -q -dir`;
- retainWorkingDirectory ($currentDir);
-
- return true;
- }
-
- //
- // Procedure Name:
- // AEimageBrowser
- //
-
- global proc AEimageBrowser( string $cmd )
- {
- string $workspace = `workspace -q -fn`;
- setWorkingDirectory $workspace "image" "sourceImages";
-
- fileBrowser ($cmd, "Open", "image", 100);
- }
-
- //
- // Procedure Name:
- // AEinputNameNew
- //
-
- global proc AEinputNameNew (string $type, string $fileAttribute)
- {
- setUITemplate -pst attributeEditorTemplate;
- rowLayout -nc 3 textureNameLayout;
- text -l "Input Name";
- textField textureNameField;
- symbolButton -image "navButtonBrowse.xpm" browser;
- setParent ..;
- setUITemplate -ppt;
-
- AEinputNameReplace $type $fileAttribute;
- }
-
- //
- // Procedure Name:
- // AEinputNameReplace
- //
-
- global proc AEinputNameReplace (string $type, string $fileAttribute)
- {
- connectControl textureNameField $fileAttribute;
-
- string $command = "AEassignImageCB "+$type+" "+$fileAttribute;
-
- button -e -c
- ("AEinputBrowser \"" + $command + "\"" ) browser;
- }
-
- //
- // Procedure Name:
- // AEoutputNameNew
- //
-
- global proc AEoutputNameNew (string $type, string $fileAttribute)
- {
- setUITemplate -pst attributeEditorTemplate;
- rowLayout -nc 3 textureNameLayout;
- text -l "Output Name";
- textField textureNameField;
- symbolButton -image "navButtonBrowse.xpm" browser;
- setParent ..;
- setUITemplate -ppt;
-
- AEoutputNameReplace $type $fileAttribute;
- }
-
- //
- // Procedure Name:
- // AEoutputNameReplace
- //
-
- global proc AEoutputNameReplace (string $type, string $fileAttribute)
- {
- connectControl textureNameField $fileAttribute;
-
- string $command = "AEassignImageCB "+$type+" "+$fileAttribute;
-
- button -e -c
- ("AEoutputBrowser \"" + $command + "\"" ) browser;
- }
-
- //
- // Procedure Name:
- // AEdisplayCurrentNew
- //
-
- global proc AEdisplayCurrentNew( string $displayOnlyIfCurrent )
- {
- setUITemplate -pst attributeEditorTemplate;
- columnLayout;
- string $collection = `radioButtonGrp -numberOfRadioButtons 1
- -label "Display "
- -label1 "looking through camera" displayOnlyIfCurrent`;
- radioButtonGrp -numberOfRadioButtons 1
- -label1 "in all views"
- -shareCollection $collection displayOnlyIfCurrent1;
- setUITemplate -ppt;
-
- AEdisplayCurrentReplace $displayOnlyIfCurrent;
- }
-
- //
- // Procedure Name:
- // AEdisplayCurrentReplace
- //
-
- global proc AEdisplayCurrentReplace( string $displayOnlyIfCurrent )
- {
- int $allViews = !`getAttr $displayOnlyIfCurrent`;
-
- setUITemplate -pst attributeEditorTemplate;
- radioButtonGrp -e
- -onCommand1 ("setAttr "+$displayOnlyIfCurrent+" on")
- displayOnlyIfCurrent;
- radioButtonGrp -e
- -onCommand1 ("setAttr "+$displayOnlyIfCurrent+" off")
- displayOnlyIfCurrent1;
-
- if ($allViews == 0) {
- radioButtonGrp -e -select 1 displayOnlyIfCurrent;
- } else {
- radioButtonGrp -e -select 1 displayOnlyIfCurrent1;
- }
- setUITemplate -ppt;
- }
-
-
- //
- // Procedure Name:
- // checkUseFrameExtension
- //
-
- global proc checkUseFrameExtension ( string $nodeName )
- {
- string $nodeAttr = $nodeName + ".useFrameExtension";
- int $value = `getAttr $nodeAttr`;
-
- if ( $value == 1 ) {
- editorTemplate -dimControl $nodeName "frameExtension" false;
- } else {
- editorTemplate -dimControl $nodeName "frameExtension" true;
- }
- }
-
- //
- // Procedure Name:
- // AEimageViewUpdateCallback
- //
- global proc AEimageViewUpdateCallback( string $imgPlane )
- {
- $newAttr = ($imgPlane + ".message");
-
- string $cameras[] = `listConnections ($imgPlane + ".message")`;
- if (size ($cameras) == 0) return;
-
- for ( $camera in $cameras ) {
- string $panels[] = `getPanel -type "modelPanel"`;
-
- for ($modelPanel in $panels) {
- string $modelCamera = `modelPanel -q -camera $modelPanel`;
-
- if ($modelCamera == $camera) {
- string $shapes[] = `listRelatives -shapes $modelCamera`;
-
- for ($shape in $shapes) {
- string $editor = `modelPanel -q -modelEditor $modelPanel`;
- modelEditor -e -updateColorMode $editor;
- break;
- }
- }
- }
- }
- }
-
- //
- // Procedure Name:
- // AEimageTemplate
- //
- global proc AEimageTemplate ( string $nodeName )
- {
- AEswatchDisplay $nodeName;
- editorTemplate -beginScrollLayout;
- editorTemplate -beginLayout "Image Attributes" -collapse 0;
- editorTemplate -callCustom "AEdisplayCurrentNew"
- "AEdisplayCurrentReplace"
- "displayOnlyIfCurrent";
-
- editorTemplate -addControl "displayMode" "AEimageViewUpdateCallback";
-
- editorTemplate -addControl "colorGain";
- editorTemplate -addControl "colorOffset";
- editorTemplate -addControl "alphaGain";
- editorTemplate -addSeparator;
-
- editorTemplate -addControl "type" "AEimageViewUpdateCallback";
-
- editorTemplate -callCustom "AEinputNameNew" "AEinputNameReplace"
- "type"
- "inputName";
- editorTemplate -callCustom "AEoutputNameNew" "AEinputNameReplace"
- "type"
- "imageName";
- editorTemplate -addControl "useFrameExtension" "checkUseFrameExtension";
- editorTemplate -addControl "frameExtension";
- editorTemplate -endLayout;
-
- editorTemplate -beginLayout "Placement Extras" -collapse 0;
- editorTemplate -addControl "coverageX";
- editorTemplate -addControl "coverageY";
- editorTemplate -addControl "coverageOriginX";
- editorTemplate -addControl "coverageOriginY";
- editorTemplate -addSeparator;
- editorTemplate -addControl "center";
- editorTemplate -addControl "width";
- editorTemplate -addControl "height";
- editorTemplate -endLayout;
-
- // include/call base class/node attributes
- AEdependNodeTemplate $nodeName;
-
- // suppressed attribute
- editorTemplate -suppress "inputName";
- editorTemplate -suppress "outputName";
- editorTemplate -suppress "coverage";
- editorTemplate -suppress "coverageOrigin";
- editorTemplate -suppress "displayOnlyIfCurrent";
-
- editorTemplate -addExtraControls;
- editorTemplate -endScrollLayout;
- }
-